<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作用域-面试题</title>
    <script>
        var x = 10
        
        function fn() {
            console.log(x)
        }
        
        function show(f) {
            var x = 20
            f()
        }
        
        show(fn) //10

        /**
         * 
         */

        var fun = function () {
            console.log(fun)
        }
        
        fun() // function(){}
        
        var obj = {
            fn2: function () {
                console.log(obj.fn2) //function(){}
                console.log(this.fn2) //对象内的属性 function(){}
                console.log(fn2) //error!
            }
        }
        
        obj.fn2()
    </script>
</head>
<body>

</body>
</html>
